/*
 * RemoteObject.java    0.0.1    Nov 3, 2009
 * 
 * Copyright (c) 2009 mentalsmash.org
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * The use of the Apache License does not indicate that this project is
 * affiliated with the Apache Software Foundation.
 */
package org.mentalsmash.tazio.net.ril;

import java.io.Serializable;

import org.mentalsmash.tazio.commons.identifiers.NID;
import org.mentalsmash.tazio.commons.identifiers.OID;
/**
 * This interface represents an instance for which method invocations are
 * handled by the Remote Invocation Handler. This allows the actual instance on
 * which the methods are invoked to reside on the local process or on some
 * remote host.<br/>
 * Instances implementing this interface can be safely cast to any other
 * interface implemented by the actual instance that they refer to.
 * 
 * @version 0.0.1 Nov 3, 2009
 * @author Andrea Sorbini <as@mentalsmash.org>
 * 
 */
public interface RemoteObject extends Serializable {
	/**
	 * @return the OID assigned to the referred instance when it was registered
	 * for remote method invocation.
	 */
	public OID getOID();
	
	/**
	 * @return the NID identifying the host this remote objects resides in.
	 */
	public NID getHostNID();
	/**
	 * @return an array containing all the methods available for invocation from remote hosts
	 */
	public RemoteMethod[] getMethods();

	/**
	 * @return true if the referred instance actually resides in the local
	 *         process (i.e. there is an instance registered with the proxied
	 *         OID in the local registry)
	 */
	public boolean isLocal();
	
	/**
	 * @return true if the instance referred by this RemoteObject is currently available
	 * in the Remote Invocation Layer either locally or on some remote host.
	 */
	public boolean isAvailable();

	/**
	 * @return the RemoteObjectProxy instance that handles methods invocation on the RemoteObject
	 */
	public RemoteObjectProxy getProxy();
}
